\(\int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx\) [212]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 16 \[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=-x-\frac {\sin (x)}{1-\cos (x)} \]

[Out]

-x-sin(x)/(1-cos(x))

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {4477, 2814, 2727} \[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=-x-\frac {\sin (x)}{1-\cos (x)} \]

[In]

Int[Cot[x]/(-Cot[x] + Csc[x]),x]

[Out]

-x - Sin[x]/(1 - Cos[x])

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 4477

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos (x)}{1-\cos (x)} \, dx \\ & = -x+\int \frac {1}{1-\cos (x)} \, dx \\ & = -x-\frac {\sin (x)}{1-\cos (x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00 \[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=\frac {1}{2} \left (-2 x-2 \cot \left (\frac {x}{2}\right )\right ) \]

[In]

Integrate[Cot[x]/(-Cot[x] + Csc[x]),x]

[Out]

(-2*x - 2*Cot[x/2])/2

Maple [A] (verified)

Time = 0.22 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.06

method result size
default \(-\frac {1}{\tan \left (\frac {x}{2}\right )}-2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )\) \(17\)
risch \(-x -\frac {2 i}{{\mathrm e}^{i x}-1}\) \(17\)

[In]

int(cot(x)/(csc(x)-cot(x)),x,method=_RETURNVERBOSE)

[Out]

-1/tan(1/2*x)-2*arctan(tan(1/2*x))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.88 \[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=-\frac {x \sin \left (x\right ) + \cos \left (x\right ) + 1}{\sin \left (x\right )} \]

[In]

integrate(cot(x)/(-cot(x)+csc(x)),x, algorithm="fricas")

[Out]

-(x*sin(x) + cos(x) + 1)/sin(x)

Sympy [F]

\[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=- \int \frac {\cot {\left (x \right )}}{\cot {\left (x \right )} - \csc {\left (x \right )}}\, dx \]

[In]

integrate(cot(x)/(-cot(x)+csc(x)),x)

[Out]

-Integral(cot(x)/(cot(x) - csc(x)), x)

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.44 \[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=-\frac {\cos \left (x\right ) + 1}{\sin \left (x\right )} - 2 \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(cot(x)/(-cot(x)+csc(x)),x, algorithm="maxima")

[Out]

-(cos(x) + 1)/sin(x) - 2*arctan(sin(x)/(cos(x) + 1))

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.75 \[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=-x - \frac {1}{\tan \left (\frac {1}{2} \, x\right )} \]

[In]

integrate(cot(x)/(-cot(x)+csc(x)),x, algorithm="giac")

[Out]

-x - 1/tan(1/2*x)

Mupad [B] (verification not implemented)

Time = 22.77 (sec) , antiderivative size = 10, normalized size of antiderivative = 0.62 \[ \int \frac {\cot (x)}{-\cot (x)+\csc (x)} \, dx=-x-\mathrm {cot}\left (\frac {x}{2}\right ) \]

[In]

int(-cot(x)/(cot(x) - 1/sin(x)),x)

[Out]

- x - cot(x/2)